};
static void
-maybe_update_keymap (void)
+update_keymap (void)
{
const void *chr_data = NULL;
GArray *keys_array;
int i;
- maybe_update_keymap ();
-
*n_keys = 0;
keys_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
int i;
guint *p;
- maybe_update_keymap ();
-
*n_entries = 0;
if (hardware_keycode > NUM_KEYCODES)
GdkModifierType bit;
guint tmp_modifiers = 0;
- maybe_update_keymap ();
-
if (keyval)
*keyval = 0;
if (effective_group)
return FALSE;
}
+static void
+input_sources_changed_notification (CFNotificationCenterRef center,
+ void *observer,
+ CFStringRef name,
+ const void *object,
+ CFDictionaryRef userInfo)
+{
+ update_keymap ();
+}
+
static void
gdk_quartz_keymap_init (GdkQuartzKeymap *keymap)
{
+ update_keymap ();
+ CFNotificationCenterAddObserver (CFNotificationCenterGetDistributedCenter (),
+ keymap,
+ input_sources_changed_notification,
+ CFSTR ("AppleSelectedInputSourcesChangedNotification"),
+ NULL,
+ CFNotificationSuspensionBehaviorDeliverImmediately);
}
static void
gdk_quartz_keymap_finalize (GObject *object)
{
+ CFNotificationCenterRemoveObserver (CFNotificationCenterGetDistributedCenter (),
+ object,
+ CFSTR ("AppleSelectedInputSourcesChangedNotification"),
+ NULL);
+
G_OBJECT_CLASS (gdk_quartz_keymap_parent_class)->finalize (object);
}